<!DOCTYPE html>
<html>

<head>

  {% if not language %}
    <title>User Messages - AIL</title>
  {% elif 'user-account' in meta %}
    <title>User Messages by Language - AIL</title>
  {% else %}
    <title>Chat Messages by Language - AIL</title>
  {% endif %}
	<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">

  <!-- Core CSS -->
	<link href="{{ url_for('static', filename='css/bootstrap4.min.css') }}" rel="stylesheet">
	<link href="{{ url_for('static', filename='css/font-awesome.min.css') }}" rel="stylesheet">
	<link href="{{ url_for('static', filename='css/dataTables.bootstrap.min.css') }}" rel="stylesheet">

  <!-- JS -->
	<script src="{{ url_for('static', filename='js/jquery.js')}}"></script>
	<script src="{{ url_for('static', filename='js/popper.min.js')}}"></script>
	<script src="{{ url_for('static', filename='js/bootstrap4.min.js')}}"></script>
	<script src="{{ url_for('static', filename='js/jquery.dataTables.min.js')}}"></script>
	<script src="{{ url_for('static', filename='js/dataTables.bootstrap.min.js')}}"></script>
    <script src="{{ url_for('static', filename='js/d3.min.js')}}"></script>
    <script src="{{ url_for('static', filename='js/d3/heatmap_week_hour.js')}}"></script>
    <script src="{{ url_for('static', filename='js/helper.js') }}"></script>


</head>
<body>

	{% include 'nav_bar.html' %}

	<div class="container-fluid">
		<div class="row">

			{% include 'sidebars/sidebar_objects.html' %}

			<div class="col-12 col-lg-10" id="core_content">

                {% if 'user-account' in meta %}
                    <h3>User {% if language %}{{ language }} Language:{% endif %}</h3>
                    {% with meta=meta['user-account'] %}
                        {% include 'chats_explorer/card_user_account.html' %}
                    {% endwith %}
                {% endif %}

                {% if 'chat' in meta %}
                    {% if meta['chat']['type'] == 'chat' %}
                        <h3>Chat {% if language %}{{ language }} Language:{% endif %}</h3>
                        {% with meta=meta['chat']  %}
                            {% include 'chats_explorer/basic_card_chat.html' %}
                        {% endwith %}
                    {% endif %}
                    {% if meta['chat']['type'] == 'chat-subchannel' %}
                        <h3>Subchannel {% if language %}{{ language }} Language:{% endif %}</h3>
                        {% with meta=meta['chat']  %}
                            {% include 'chats_explorer/card_chat_subchannel.html' %}
                        {% endwith %}
                    {% endif %}
                {% endif %}

                <div class="mt-2">
                {% if not language %}
                    {% with translate_url=url_for('chats_explorer.objects_user_account_chat', subtype=meta['user-account']['subtype']), obj_id=meta['user-account']['id'], chat_id=meta['chat']['id'] %}
                        {% include 'chats_explorer/block_translation.html' %}
                    {% endwith %}
                {% elif 'user-account' in meta %}
                    {% with translate_url=url_for('chats_explorer.objects_user_account_lang', subtype=meta['user-account']['subtype']), obj_id=meta['user-account']['id'] %}
                        {% include 'chats_explorer/block_translation.html' %}
                    {% endwith %}
                {% elif 'chat' in meta %}
                    {% with translate_url=url_for('chats_explorer.chats_explorer_chat_lang', subtype=meta['chat']['subtype']), obj_id=meta['chat']['id'], chat_type=meta['chat']['type'] %}
                        {% include 'chats_explorer/block_translation.html' %}
                    {% endwith %}
                {% endif %}
                {% include 'objects/image/block_blur_img_slider.html' %}
                </div>


                <div class="position-relative">
                    <div class="chat-messages p-2">

                        {% for date in meta['messages'] %}

                            <div class="divider d-flex align-items-center mb-4">
                                <p class="text-center h2 mx-3 mb-0" style="color: #a2aab7;">
                                    <span class="badge badge-secondary mb-2" id="date_section_{{ date }}">{{ date }}</span>
                                </p>
                            </div>

                            {% for mess in meta['messages'][date] %}

                                {% with message=mess %}
                                    {% include 'chats_explorer/block_message.html' %}
                                {% endwith %}

                            {% endfor %}
                            <br>
                        {% endfor %}

                    </div>
                </div>



{#                {% if meta['chats'] %}#}
{#                    <h4 class="mx-5 mt-2 text-secondary">User All Messages:</h4>#}
{#                    <div id="heatmapweekhourall"></div>#}
{##}
{#                    <h4>User Chats:</h4>#}
{#                    {% for meta_chats in meta['chats'] %}#}
{#                        <div class="my-2">#}
{#                            {% with meta=meta_chats  %}#}
{#                                {% include 'chats_explorer/basic_card_chat.html' %}#}
{#                            {% endwith %}#}
{#                        </div>#}
{#                    {% endfor %}#}
{#                {% endif %}#}


            </div>

        </div>
    </div>

<script>
    $(document).ready(function(){
        $("#page-Decoded").addClass("active");
        $("#nav_chat").addClass("active");

  });

{#d3.json("{{ url_for('chats_explorer.user_account_messages_stats_week_all') }}?subtype={{ meta['subtype'] }}&id={{ meta['id'] }}")#}
{#    .then(function(data) {#}
{#        create_heatmap_week_hour('#heatmapweekhourall', data);#}
{#    })#}

function toggle_sidebar(){
	if($('#nav_menu').is(':visible')){
		$('#nav_menu').hide();
		$('#side_menu').removeClass('border-right')
		$('#side_menu').removeClass('col-lg-2')
		$('#core_content').removeClass('col-lg-10')
	}else{
		$('#nav_menu').show();
		$('#side_menu').addClass('border-right')
		$('#side_menu').addClass('col-lg-2')
		$('#core_content').addClass('col-lg-10')
	}
}

</script>





</body>

</html>
